package utstat.listeners;

import static utstat.Type.kill;

import java.util.HashMap;
import java.util.Map;

import utstat.UtEvent;
import utstat.UtEventListener;

/**
 * 3 knife kills in a game
 */
public class ExcellenceListener implements UtEventListener {

	private Map<String, Integer> lastKillTime = new HashMap<String, Integer>();
	private int currentRound = -1;

	@Override
	public String getIntestingFact(String player) {
		return null;
	}

	@Override
	public void processEvent(UtEvent e) {
		if (e.getRound() != currentRound) {
			nextRound();
			currentRound = e.getRound();
		}
		if (e.getType() == kill) {
	
			if(lastKillTime.get(e.getSrc())!=null&&e.getTime()-lastKillTime.get(e.getSrc())<2) System.out.println("Excellent: "+e.getSrc());
			lastKillTime.put(e.getSrc(),e.getTime());
		}
	}


	private void nextRound() {
		System.out.println("---");
		lastKillTime = new HashMap<String, Integer>();
	}

}
